package edu.pku.sei.act.main.palette;

import java.util.ArrayList;
import java.util.List;

import edu.pku.sei.act.images.ArchiModelImageProvider;
import edu.pku.sei.act.model.common.ArchiModelConst;
import edu.pku.sei.gmp.editor.palette.GMPEntryDescriptor;
import edu.pku.sei.gmp.editor.palette.GMPEntryType;
import edu.pku.sei.gmp.editor.palette.GMPPaletteFactory;
import edu.pku.sei.gmp.model.common.GMPModel;

public class ArchiModelerTaskPaletteFactory extends GMPPaletteFactory {

	public ArchiModelerTaskPaletteFactory(GMPModel model) {
		super(model);
	}

	@Override
	protected List<GMPEntryDescriptor> getEntryList(String diagramType) {
		if (diagramType.equals(ArchiModelConst.__ARCHIMODELTASKDIAGRAM__)) {
			List<GMPEntryDescriptor> desc = new ArrayList<GMPEntryDescriptor>();
			
			GMPEntryDescriptor entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.__TASKEDITAREA__;
			entry.label = "Task";
			entry.shortDesc = "Create a Task";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.TASK);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);
			
			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.INITIALNODE;
			entry.label = "InitialNode";
			entry.shortDesc = "Create a InitialNode";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.INITIALNODE);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);

			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.ACTION;
			entry.label = "Action";
			entry.shortDesc = "Create a Action";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.ACTION);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);
			
			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.SENDACTION;
			entry.label = "SendAction";
			entry.shortDesc = "Create a SendAction";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.SENDACTION);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);
			
			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.ACCEPTACTION;
			entry.label = "AcceptAction";
			entry.shortDesc = "Create a AcceptAction";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.ACCEPTACTION);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);
			
			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.DECISIONNODE;
			entry.label = "DecisionNode";
			entry.shortDesc = "Create a DecisionNode";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.DECISIONNODE);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);
			
			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.MERGENODE;
			entry.label = "MergeNode";
			entry.shortDesc = "Create a MergeNode";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.MERGENODE);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);
			
			entry = new GMPEntryDescriptor();
			entry.elementType = ArchiModelConst.ACTIVITYFINAL;
			entry.label = "ActivityFinal";
			entry.shortDesc = "Create a ActivityFinal";
			entry.iconSmall = ArchiModelImageProvider
					.getImageDescriptor(ArchiModelImageProvider.ACTIVITYFINAL);
			entry.entryType = GMPEntryType.NODE;
			desc.add(entry);

			return desc;

		} else {
			return null;
		}

	}
}
